package com.hospicpc.demos.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hospicpc.demos.entity.User;
import com.hospicpc.demos.entity.UserInfo;
import com.hospicpc.demos.mapper.UserInfoMapper;
import com.hospicpc.demos.mapper.UserMapper;
import com.hospicpc.demos.service.UserInfoService;
import com.hospicpc.demos.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService {

    @Autowired
    private UserInfoMapper userInfoMapper;


    @Override
    public UserInfo getNickNameByUserId(Integer userId) {
        QueryWrapper<UserInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return userInfoMapper.selectOne(queryWrapper);
    }

    @Override
    public String getUserIdById(String userId) {
        return userInfoMapper.queryUserIdById(userId);
    }

    @Override
    public String getNickNameById(String userId) {
        return userInfoMapper.selectNickNameById(userId);
    }

}
